#ifndef APPSETTINGS_HPP
#define APPSETTINGS_HPP

#include <QObject>
#include <QSettings>
#include <QDir>

/**
* @brief Class containing Setter and Getter functions to the Settings
* @details This class functions as a kind of Interface providing access to the Settings while
* prohibiting direct access to them.
*
* @class AppSettings appsettings.hpp "appsettings.hpp"
*/
class AppSettings : public QObject
{
Q_OBJECT
public:

    /**
    * @brief Request the Instance of the current AppSettings Object
    * @details A new Instance will be created if none is existing yet
    *
    * @fn static AppSettings *getInstance()
    * @return AppSettings
    */
    static AppSettings *getInstance();

    /**
    * @brief Release your copy of the current AppSettings Instance
    * @details If the AppSettings is not used by any other Class, it will be deleted
    *
    * @fn static void releaseInstance()
    */
    static void releaseInstance();

    /**
    * @brief Set the Geometry for the MainWindow
    * @details The current geometry of MainWindow will be saved. \n
    * This includes position, size and mode (fullscreen, window, ...)
    * @see QByteArray getMainWindowGeometry()
    *
    * @fn void setMainWindowGeometry(QByteArray value)
    * @param value
    */
    void setMainWindowGeometry(QByteArray value);

    /**
    * @brief Get the last saved Geometry of the MainWindow
    * @details The last saved state will be loaded.
    * @see void setMainWindowGeometry(QByteArray value)
    *
    * @fn QByteArray getMainWindowGeometry()
    * @return QByteArray
    */
    QByteArray getMainWindowGeometry();

    /**
    * @brief Set the State for the MainWindow
    * @details This will save the current State of the MainWindow \n
    * The saved information includes open DockWidgets, their state and position, size, ...
    * @see QByteArray getMainWindowState()
    *
    * @fn void setMainWindowState(QByteArray value)
    * @param value
    */
    void setMainWindowState(QByteArray value);

    /**
    * @brief Get the last saved state of the MainWindow
    * @details The state of the MainWindow in Settings will be loaded
    * @see void setMainWindowState(QByteArray value)
    *
    * @fn getMainWindowState
    * @return QByteArray
    */
    QByteArray getMainWindowState();

    /**
    * @brief Check if a specified key is present in the Settings
    * @details This function checks if a specified key can be found in the Settings \n
    * Will return true if any content for this key can be found
    *
    * @fn contains
    * @param key
    * @return bool
    */
    bool contains(QString key) const;

private:
    /**
    * @brief Constructor (private)
    *
    * @fn AppSettings
    */
    AppSettings();

    /**
    * @brief Destructor (private)
    *
    * @fn ~AppSettings
    */
    ~AppSettings();

    static int instanceCounter;
    static AppSettings *instance;
    QSettings *settings;

};

#endif // APPSETTINGS_HPP
